<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.List" %>
<%@ page import="com.itheima.domain.User" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
      <%
          List<User> list =new ArrayList<>();
          User u =new User();
          u.setId(1);
          u.setPwd("123");
          u.setUsername("aaaa1");
          User u1 =new User();
          u1.setId(2);
          u1.setPwd("123");
          u1.setUsername("aaaa2");
          User u2 =new User();
          u2.setId(3);
          u2.setPwd("123");
          u2.setUsername("aaaa3");

          User  u3 =new User();
          u3.setId(4);
          u3.setPwd("123");
          u3.setUsername("aaaa4");
          list.add(u);
          list.add(u1);
          list.add(u2);
          list.add(u3);

          request.setAttribute("list",list);

      %>
<%--遍历--%>
<%--
    item:需要遍历的集合或者数组
    支持el表达式
    var:申明变量用来接受每一次遍历集合或者对象的元素
    begin:指定遍历的起始索引位置
    end:指定遍历的结束索引位置
    step:步调
    varStatus
--%>
<c:forEach items="${list}" var="u" begin="0" end="3" step="1" varStatus="i">
    ${i.index}--${u.username}<br>
</c:forEach>

<%--判断--%>
<c:if test="${list[0].id==2}">
    ok
</c:if>
<c:if test="true">
    no
</c:if>
</body>
</html>
